﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DB2Provider;

namespace Bussiness
{
    /// <summary>
    /// 报警记录类
    /// </summary>
    public class AlarmRecord
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int ID_KEY { get; set; }
        /// <summary>
        /// 报警描述
        /// </summary>
        public string AlarmDescription { get; set; }
        /// <summary>
        /// 返回报警结果集
        /// </summary>
        /// <returns></returns>
        public DataTable GetAlarm()
        {
            string sql = "SELECT * FROM T_ALARM_INFO";
            DataLink link = new DataLink();
            DataTable dt = link.ExcuteRetureTable(sql);
            return dt;
        }
        /// <summary>
        /// 返回报警描述
        /// </summary>
        /// <returns></returns>
        public string GetAlarmDescription()
        {
            if (ID_KEY.ToString() == "")
                return "";
            string sql = "SELECT * FROM T_ALARM_INFO WHERE ID_KEY='" + ID_KEY + "'";
            DataLink link = new DataLink();
            string bzDesc = "";
            object obj = link.GetFirstValue(sql);
            if (obj != null && obj != DBNull.Value)
                bzDesc = obj.ToString();
            return bzDesc;
        }
        /// <summary>
        /// 返回报警描述
        /// </summary>
        /// <param name="id_key">编号</param>
        /// <returns></returns>
        public string GetAlarmDescription(string id_key)
        {
            if (id_key == "")
                return "";
            string sql = "SELECT * FROM T_ALARM_INFO WHERE ID_KEY='" + id_key + "'";
            DataLink link = new DataLink();
            string bzDesc = "";
            object obj = link.GetFirstValue(sql);
            if (obj != null && obj != DBNull.Value)
                bzDesc = obj.ToString();
            return bzDesc;
        }
    }
}
